var _common_util = require('util/common_util.js');

var _good_service = {

    getRecommend : function(resolve, reject) {
        _common_util.request({
            url     : _common_util.getServerURL('product'),
            success : resolve,
            error   : reject
        });
    },
    search : function(query, resolve, reject) {
        _common_util.request({
            url     : _common_util.getServerURL('product?query=' + query),
            success : resolve,
            error   : reject
        });
    },
    detail : function(id, resolve, reject) {
        _common_util.request({
            url     : _common_util.getServerURL('product/' + id),
            success : resolve,
            error   : reject
        })
    },
    similar : function(id, resolve, reject) {
        _common_util.request({
            url     : _common_util.getServerURL('recommend?productId=' + id),
            success : resolve,
            error   : reject
        })
    }

}

module.exports = _good_service